<template>
	<view class="wrap">
		<view v-if="flowList.length">
		  <u-waterfall v-model="flowList" ref="uWaterfall">
			<template v-slot:left="{leftList}">
				<view class="demo-warter"  v-for="(item, index) in leftList" @tap="toDetail(item.id)" :key="item.id">
					<!-- 警告：微信小程序不支持嵌入lazyload组件，请自行如下使用image标签 -->
					<!-- #ifndef MP-WEIXIN -->
						<u-lazy-load threshold="-450" border-radius="10" :image="item.cover" :index="index"></u-lazy-load>
					<!-- #endif -->
					<!-- #ifdef MP-WEIXIN -->
					<view class="demo-img-wrap">
						<image class="demo-image" :src="item.cover" mode="heightFix"></image>
					</view>
					<!-- #endif -->
					<view class="demo-title text-df padding-left-xs">
						{{item.name}}
					</view>
					<!-- <view class="demo-price">
						{{item.price}}元
					</view>
					<view class="demo-tag">
						<view class="demo-tag-owner">
							热门
						</view>
						<view class="demo-tag-text">
							自由行
						</view>
					</view>-->
					<view class="demo-tag flex-wrap">
						<view class="cu-tag round line-red margin-xs" v-for="(item,index) in item.type" :key="index">{{item}}</view>
					</view>
					<view class="demo-shop padding-left-xs">
						{{item.address}}
					</view>
				</view>
			</template>
			<template v-slot:right="{rightList}">
				<view class="demo-warter" v-for="(item, index) in rightList" @click.stop="toDetail(item.id)" :key="item.id">
					<!-- #ifndef MP-WEIXIN -->
						<u-lazy-load threshold="-450" border-radius="10" :image="item.cover" :index="index"></u-lazy-load>
					<!-- #endif -->
					<!-- #ifdef MP-WEIXIN -->
					<view class="demo-img-wrap">
						<image class="demo-image" :src="item.cover" mode="heightFix"></image>
					</view>
					<!-- #endif -->
					<view class="demo-title text-df padding-left-xs">
						{{item.name}}
					</view>
					<view class="demo-tag flex flex-wrap">
						<view class="cu-tag round line-red margin-xs" v-for="(item,index) in item.type" :key="index">{{item}}</view>
					</view>
					<!-- <view class="demo-price">
						{{item.price}}元
					</view> 
					<view class="demo-tag">
						<view class="demo-tag-owner">
							热门
						</view>
						<view class="demo-tag-text">
							自由行
						</view>
					</view>-->
					<view class="demo-shop padding-left-xs">
						{{item.address}}
					</view>
				</view>
			</template>
		  </u-waterfall>
		</view>
		<u-loadmore :status="loadStatus" @loadmore="addRandomData"></u-loadmore>
	</view>
</template>

<script>
	import {mapActions,mapGetters,store} from 'vuex';
	export default {
		computed:{
			...mapGetters('home',{
				loadStatus:'getloadStatus',
				flowList:'getList'
			}),
		},
		data() {
			return {
				
			}
		},
		methods: {
			...mapActions('home',['getList']),
			addRandomData(){
				// console.log("this.current");
				// this.getList();
			},
			remove(id) {
				// this.$refs.uWaterfall.remove(id);
			},
			clear() {
				// this.$refs.uWaterfall.clear();
			},
			toDetail(id){
				console.log("id",id);
				uni.navigateTo({
					url:'/pages/index/detail?id='+id,
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.wrap{
	}
	.demo-warter {
		border-radius: 8px;
		margin: 5px;
		padding: 8px;
		position: relative;
		box-shadow: 0 2rpx 20rpx 4rpx rgba(0,0,0,.1);
	}
	
	.u-close {
		position: absolute;
		top: 32rpx;
		right: 32rpx;
	}
	
	.demo-image {
		width: 100%;
		border-radius: 4px;
	}
	
	.demo-title {
		font-size: 30rpx;
		margin-top: 5px;
		color: $u-main-color;
	}
	
	.demo-tag {
		display: flex;
		margin-top: 5px;
	}
	
	.demo-tag-owner {
		background-color: $u-type-error;
		color: #FFFFFF;
		display: flex;
		align-items: center;
		padding: 4rpx 14rpx;
		border-radius: 50rpx;
		font-size: 20rpx;
		line-height: 1;
	}
	
	.demo-tag-text {
		border: 1px solid $u-type-primary;
		color: $u-type-primary;
		margin-left: 10px;
		border-radius: 50rpx;
		line-height: 1;
		padding: 4rpx 14rpx;
		display: flex;
		align-items: center;
		border-radius: 50rpx;
		font-size: 20rpx;
	}
	
	.demo-price {
		font-size: 30rpx;
		color: $u-type-error;
		margin-top: 5px;
	}
	
	.demo-shop {
		font-size: 22rpx;
		color: $u-tips-color;
		margin-top: 5px;
	}
</style>